package cn.yanglq.Rss.web.service.impl;

import cn.yanglq.Rss.core.util.mailUtil.SendMail;
import cn.yanglq.Rss.web.service.MailService;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.security.GeneralSecurityException;

/**
 * Created by yanglq on 2018/1/19.
 */
@Service
public class MailServiceImpl implements MailService {
    @Override
    public boolean sendEmail(String regEmail, String sms) {
        boolean sendSuc = false;
        try {
            if (sendSM(regEmail, sms))
                sendSuc = true;
        } catch (GeneralSecurityException | IOException | ClassNotFoundException e) {
            e.printStackTrace();
        }
        return sendSuc;
    }

    private boolean sendSM(String regEmail, String sms) throws GeneralSecurityException, IOException, ClassNotFoundException {
        SendMail mail = new SendMail();
        mail.sendMail(regEmail, sms);
        return true;
    }
}
